package com.cn.aam.checaiduo.ui.product.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.cn.aam.checaiduo.R;
import com.cn.aam.checaiduo.base.adapter.BaseRecycerAdapter;
import com.cn.aam.checaiduo.base.adapter.holder.BaseRecyclerViewHolder;
import com.cn.aam.checaiduo.bean.InfoOfDetailB;

import butterknife.BindView;


/**
 * @author 微木森林
 * @time 2017/6/1 下午3:16
 * @description 详情页基本信息的适配器
 * @remark
 */
public class InfoOfDetailAdapter extends BaseRecycerAdapter<InfoOfDetailB> {


    public InfoOfDetailAdapter(Context mContext) {
        super(mContext);
    }

    //item
    @Override
    protected BaseRecyclerViewHolder getViewHolder(View picNewsView) {
        return new ItemViewHolder(picNewsView);
    }

    @Override
    protected int getItemLayoutRes() {
        return R.layout.list_item_detail_basic_info;
    }


    @Override
    protected void ItemVIewChange(BaseRecyclerViewHolder recyclerholder, final int position) {
        final ItemViewHolder myholdet = (ItemViewHolder) recyclerholder;
        int current = position;
        //color
        if (position % 2 == 0) {
            myholdet.itemView.setBackgroundColor(Color.argb(255, 254, 245, 245));
        } else {
            myholdet.itemView.setBackgroundColor(Color.argb(255, 255, 255, 255));
        }
        final InfoOfDetailB item = getItem(position);
        //key
        myholdet.tvTitle.setText(item.getKey());
        //value
        myholdet.tvValue.setText(item.getValue());
    }


    //Item
    class ItemViewHolder extends BaseRecyclerViewHolder {
        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_value)
        TextView tvValue;


        ItemViewHolder(View view) {
            super(view);
        }
    }


}